package com.anmory.myhelloworld;

import ch.qos.logback.core.util.StringUtil;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@SpringBootApplication
@RequestMapping
public class MyHelloWorldApplication {
    public static void main(String[] args) {
        SpringApplication.run(MyHelloWorldApplication.class, args);
    }

    @GetMapping("/hello")
    public String sayHello(@RequestParam(required = false,name = "who") String who) {
        if(StringUtil.isNullOrEmpty(who)){
            who = "World";
        }
        return "hello" + who;
    }
}
